package com.example.everying.model.entity.content;

import com.baomidou.mybatisplus.annotation.*;
import com.example.everying.model.vo.content.ActivityCommentVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @program: everything
 * @description: 评论记录
 * @author: zw
 * @create: 2025-05-19 09:26
 **/
@Data
@ApiModel(description = "comment内容表")
@TableName("activity_comment")
@NoArgsConstructor
@AllArgsConstructor
public class ActivityComment implements Serializable {
    private static final long serialVersionUID = 1L;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "评论主键")
    @TableId("id")
    private String id;


    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "用户id")
    @TableField("user_id")
    private String userId;

    @ApiModelProperty(value = "评论内容")
    @TableField("content")
    private String content;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "内容id")
    @TableField("article_id")
    private String articleId;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "上级id")
    @TableField("parent_id")
    private String parentId;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime = LocalDateTime.now();

    @ApiModelProperty(value = "评论位置")
    private String location;

    @ApiModelProperty(value = "逻辑删除(1:已删除，0:未删除)")
    @TableLogic//逻辑删除
    @TableField("is_delete")
    private Integer isDelete;

    @ApiModelProperty(value = "评论图片路径")
    @TableField("com_picture_url")
    private String comPictureUrl;

    @Getter
    @ApiModelProperty(value = "是否包含子节点")
    @TableField(exist = false)
    private boolean hasChildren;

    @ApiModelProperty(value = "子节点")
    @TableField(exist = false)
    private List<ActivityCommentVo> children;

}
